package br.com.gip.commons.base.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="CATEGORIA")
public class Categoria implements Serializable {

	private static final long serialVersionUID = -7053736647713815811L;

	@Id
	@Column(name="CATEGORIA_ID")
	@SequenceGenerator(name="SQ_CATEGORIA_PK", sequenceName="SQ_CATEGORIA_PK", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SQ_CATEGORIA_PK")
	private Long categoriaId;
	
	@Column(name="NOME", unique=true, nullable=false, length=64)
	private String nome;
	
	@Column(name="DESCRICAO", length=128)
	private String descricao;

	public Long getCategoriaId() {
		return categoriaId;
	}

	public void setCategoriaId(Long categoriaId) {
		this.categoriaId = categoriaId;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((categoriaId == null) ? 0 : categoriaId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Categoria other = (Categoria) obj;
		if (categoriaId == null) {
			if (other.categoriaId != null) {
				return false;
			}
		} else if (!categoriaId.equals(other.categoriaId)) {
			return false;
		}
		return true;
	}
	
}
